﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    public class Member_DAL
    {
        public Member_DAL(Context context)
        {
            Context = context;
        }

        public Context Context { get; }

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Pwd"></param>
        /// <returns></returns>
        public int Login(string? Name, string?Pwd)
        {
            var m=Context.Member_Model.FirstOrDefault(x=>x.Name == Name);
            if(m == null)
            {
                return -1;
            }
            else
            {
                if(m.Pwd==Pwd)
                {
                    return m.Id;
                }
                else
                {
                    return -2;
                }
            }
        }
    }
}
